# -*- coding:utf-8 -*-
from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import List, Literal, Optional, Union
from module_admin.annotation.pydantic_annotation import as_query


class BgProductModel(BaseModel):
    """
    表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True, populate_by_name=True)
    create_by: Optional[int] =  Field(default=None, description='创建者')
    create_time: Optional[datetime] =  Field(default=None, description='创建时间')
    del_flag: Optional[str] =  Field(default=None, description='删除标志')
    dept_id: Optional[int] =  Field(default=None, description='部门id')
    discount: Optional[int] =  Field(default=None, description='折扣%')
    id: Optional[int] =  Field(default=None, description='id')
    index: Optional[int] =  Field(default=None, description='排序')
    month: Optional[int] =  Field(default=None, description='套餐周期')
    name: Optional[str] =  Field(default=None, description='套餐名称')
    price: Optional[int] =  Field(default=None, description='价格')
    status: Optional[str] =  Field(default=None, description='状态')
    update_time: Optional[datetime] =  Field(default=None, description='更新时间')
    description: Optional[str] =  Field(default=None, description='套餐描述')
    is_popular: Optional[bool] =  Field(default=False, description='是否热门')
    max_downloads: Optional[int] =  Field(default=None, description='最大下载次数')
    tip: Optional[str] =  Field(default=None, description='套餐类型')



@as_query
class BgProductPageModel(BgProductModel):
    """
    分页查询模型
    """
    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')


